# Author    : CoffeeChicken
# Date      : 2020-10-04 12:06
# Function  : 演示 插入关键词搜索

import requests


headers = {
    'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) "
                  "Chrome/85.0.4183.121 Safari/537.36"
}
# 必应会劫持pycharm发起的请求
url = "https://cn.bing.com/search"

param = {
    "q": "CoffeeChicken"
}
# 直接发起请求会被网站劫持, 需要加上伪装
response = requests.get(url=url, params=param, headers=headers)

result = response.text
with open("search.html", "w") as fp:
    fp.write(result)
